package com.yxy.system.service.impl;

import java.util.List;
import com.yxy.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.yxy.system.mapper.ApiConfigMapper;
import com.yxy.system.domain.ApiConfig;
import com.yxy.system.service.IApiConfigService;

/**
 * 接口配置Service业务层处理
 * 
 * @author 402844673@qq.com
 * @date 2025-09-02
 */
@Service
public class ApiConfigServiceImpl implements IApiConfigService 
{
    @Autowired
    private ApiConfigMapper apiConfigMapper;

    /**
     * 查询接口配置
     * 
     * @param id 接口配置主键
     * @return 接口配置
     */
    @Override
    public ApiConfig selectApiConfigById(Long id)
    {
        return apiConfigMapper.selectApiConfigById(id);
    }

    /**
     * 查询接口配置列表
     * 
     * @param apiConfig 接口配置
     * @return 接口配置
     */
    @Override
    public List<ApiConfig> selectApiConfigList(ApiConfig apiConfig)
    {
        return apiConfigMapper.selectApiConfigList(apiConfig);
    }

    /**
     * 新增接口配置
     * 
     * @param apiConfig 接口配置
     * @return 结果
     */
    @Override
    public int insertApiConfig(ApiConfig apiConfig)
    {
        apiConfig.setCreateTime(DateUtils.getNowDate());
        return apiConfigMapper.insertApiConfig(apiConfig);
    }

    /**
     * 修改接口配置
     * 
     * @param apiConfig 接口配置
     * @return 结果
     */
    @Override
    public int updateApiConfig(ApiConfig apiConfig)
    {
        apiConfig.setUpdateTime(DateUtils.getNowDate());
        return apiConfigMapper.updateApiConfig(apiConfig);
    }

    /**
     * 批量删除接口配置
     * 
     * @param ids 需要删除的接口配置主键
     * @return 结果
     */
    @Override
    public int deleteApiConfigByIds(Long[] ids)
    {
        return apiConfigMapper.deleteApiConfigByIds(ids);
    }

    /**
     * 删除接口配置信息
     * 
     * @param id 接口配置主键
     * @return 结果
     */
    @Override
    public int deleteApiConfigById(Long id)
    {
        return apiConfigMapper.deleteApiConfigById(id);
    }

    @Override
    public ApiConfig selectApiByUserName(String username) {
        return apiConfigMapper.selectApiByUserName(username);
    }
}
